package com.itheima.service.impl;

import com.itheima.domain.Category;
import com.itheima.mapper.CategoryMapper;
import com.itheima.service.CategoryService;
import com.itheima.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class CategoryServiceImpl implements CategoryService {

    @Override
    public List<Category> findCategoryAll() {
        SqlSession sqlSession = MyBatisUtil.openSession();
        CategoryMapper mapper = sqlSession.getMapper(CategoryMapper.class);
        List<Category> categoryList = mapper.findCategoryAll();
        MyBatisUtil.closeSession(sqlSession);
        return categoryList;
    }
}
